package site.bianma.hybrid.service.impl

import org.springframework.beans.BeanUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import site.bianma.hybrid.dto.AuthorDTO
import site.bianma.hybrid.mapper.AuthorMapper
import site.bianma.hybrid.model.Author
import site.bianma.hybrid.service.AuthorService

/**
 * 类描述
 *
 * @author liangrun
 * @create 2018-06-12 17:12
 * @version 1.0
 */
@Service
class AuthorServiceImpl : AuthorService {
    @Autowired
    private lateinit var authorMapper: AuthorMapper

    override fun add(author: AuthorDTO): Long {
        var record = Author()
        BeanUtils.copyProperties(author, record)
        authorMapper.insertSelective(record)
        return record.id
    }
}